/**
 * Place holder for copyright, needs to be replaced before release.
 */
package com.softao.ming.gwt.ui.client;


/**
 * 
 */
public interface ISizeProvider {
	/**
	 * Constant used to indicate infinite size. This is equal to Integer.MAX_VALUE, ensuring
     * that it is greater than any other integer.
	 */
	public static final int INFINITE = Integer.MAX_VALUE;
	
	/** Size unknown */
	public static final int UNKNOWN = -1;
	
	/** */
	public static final int MAX = 1 << 10;
	
	/** */
	public static final int MIN = 1 << 7;

	/**
	 * @param width
	 *            <code>true</code> for width, <code>false</code> for height.
	 * @return any bitwise combination of {@link #MAX} and {@link #MIN}.
	 */
	public int getSizeFlags(boolean width);
	
	/**
	 * @param width
	 *            <code>true</code> for width, <code>false</code> for height.
	 * @param availableParallel
	 *            available space. A return value larger than this will be
	 *            ignored.
	 * @param availablePerpendicular
	 *            {@link #INFINITE} for unbound; otherwise, limited the vertical
	 *            size.
	 * @param preferredResult
	 *            preferred size of the control (pixels, <= availableParallel).
	 *            Set to INFINITE if unknown or unbounded.
	 * @return returns the preferred size of the control (pixels). This is a
	 *         width if width == true or a height if width == false. Callers are
	 *         responsible for rounding down the return value if it is larger
	 *         than availableParallel. If availableParallel is INFINITE, then a
	 *         return value of INFINITE is permitted, indicating that the
	 *         preferred size of the control is unbounded.
	 */
	public int computePreferredSize(boolean width, int availableParallel,
			int availablePerpendicular, int preferredResult);
}
